package com.sky.task;

import com.sky.entity.Orders;
import com.sky.mapper.OrderMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * 自定义定时任务类
 */
@Slf4j
@Component//实例化, 自动生成bean放入spring容器中管理
public class MyTask {

    private final OrderMapper orderMapper;

    public MyTask(OrderMapper orderMapper) {
        this.orderMapper = orderMapper;
    }

    /**
     * 每5秒执行一次
     */
//    @Scheduled(cron = "0/5 * * * * ?")
    public void executeTask(){
        log.info("执行定时任务: {}",new Date());

    }
}
